package com.thirtydays.frame.ui.pop

import android.content.Context
import com.blankj.utilcode.util.ScreenUtils
import com.lxj.xpopup.core.CenterPopupView
import com.thirtydays.frame.R
import com.thirtydays.frame.databinding.DealPopViewBinding
import com.thirtydays.frame.util.ext.clicks
import kotlin.math.roundToInt

/*
 * @创建者：小垚
 * @时间：2021/7/21
 * @描述： 隐私协议
 */
class DealPopupView(context: Context) : CenterPopupView(context) {

    override fun getImplLayoutId() = R.layout.deal_pop_view

    lateinit var viewBinding: DealPopViewBinding
    override fun onCreate() {
        viewBinding = DealPopViewBinding.bind(contentView)

        viewBinding.webview.loadUrl("https://h5.jbtcmy.com/privacyPolicy")

        viewBinding.tvCancel.clicks {
            dismiss()
        }

        viewBinding.tvConfirm.clicks {
            dismiss()
        }
    }

    override fun getMaxWidth() = (ScreenUtils.getScreenWidth() * 0.8).roundToInt()

    override fun getMaxHeight() = (ScreenUtils.getScreenHeight() * 0.8).roundToInt()
}